//拦截器
//请求拦截和响应拦截
//直接引用axios
import axios from 'axios';


//请求拦截axios.interceptors
// axios.defaults.baseURL = '/api'
axios.defaults.baseUrl = '/api' //公共部分提取出来
axios.interceptors.request.use(config => {
        console.log(config, '请求拦截');
        return config;
    }, err => {
        console.log(err);
    })
    //响应拦截
axios.interceptors.response.use(response => {
    console.log(response, '响应拦截');
    response = response.data
    return response;
}, err => {
    console.log(err);
})

export default axios